package info.empathymobile.monitor.receivers;

import info.empathymobile.monitor.EmpathyMonitorController;
import info.empathymobile.monitor.business.beans.MonitorEntry;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;


public class ShutdownReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {
		SharedPreferences sharedPref = context.getSharedPreferences(EmpathyMonitorController.EMPATHY_MONITOR_SHARED_PREFERENCES, Context.MODE_MULTI_PROCESS);
		SharedPreferences.Editor sharedPrefEditor = sharedPref.edit();
		sharedPrefEditor.clear();
		sharedPrefEditor.putBoolean(EmpathyMonitorController.DO_THE_BOOT_SCAN_PREFERENCE, true);
		sharedPrefEditor.commit();
		
		new EmpathyMonitorController(context).initAsyncEmpathyMonitorScan(MonitorEntry.OS_ENTRY_LOG_CLASS, MonitorEntry.OS_ENTRY_SHUTDOWN);
	}
}
